set

type set<T: -immutable> : collection<T>

Represents a mutable set of elements. The set is a hash-set with an iteration order determined by the order the elements was first added to the set.

Since

0.6.0

Constructors

Link copied to clipboard
pure constructor()

Constructs an empty set.

pure constructor(values: iterable<-T>)

Constructs a set from the elements of the provided iterable.

Functions

Link copied to clipboard
function add(value: T): boolean

Adds an element to the collection.

Link copied to clipboard
function add_all(values: collection<-T>): boolean

Adds all elements from another collection to this collection.

Link copied to clipboard
(alias) function addAll(values: collection<-T>): boolean

Adds all elements from another collection to this collection.

Alias
Link copied to clipboard
function clear()

Clears the collection.

Link copied to clipboard
pure function contains(value: T): boolean

Checks if the collection contains a specific element.

Link copied to clipboard
pure function contains_all(values: collection<-T>): boolean

Checks if the collection contains all elements of another collection.

Link copied to clipboard
(alias) pure function containsAll(values: collection<-T>): boolean

Checks if the collection contains all elements of another collection.

Link copied to clipboard
pure function empty(): boolean

Checks if the collection is empty.

Link copied to clipboard
pure function join_to_text([separator: text], [prefix: text], [postfix: text], [limit: integer?], [truncated: text], [transform: (T) -> text]): text

Creates a text from all the elements separated using separator and using the given prefix and postfix if supplied.

If the iterable is large, you can specify a non-negative value of limit, in which case only the first limit of elements will be appended, followed by the truncated text (which defaults to "...").

Link copied to clipboard
(alias) pure function len(): integer

Returns the size of the collection.

Alias
Link copied to clipboard
function remove(value: T): boolean

Removes an element from the collection.

Link copied to clipboard
function remove_all(values: collection<-T>): boolean

Removes all elements from the collection that are present in another collection.

Link copied to clipboard
(alias) function removeAll(values: collection<-T>): boolean

Removes all elements from the collection that are present in another collection.

Link copied to clipboard
pure function size(): integer

Returns the size of the collection.

Link copied to clipboard
pure function sorted(): list<T>

Returns a new sorted list of elements from the collection.

Link copied to clipboard
(alias) pure function str(): text

Converts the collection to a text representation.

Alias
Link copied to clipboard
pure function to_text(): text

Converts the collection to a text representation.